package com.tekj.cxqcb.view.Module.activity.ServiceOrder.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tekj.cxqcb.R;
import com.tekj.cxqcb.operation.resultBean.ShopServiceOrder;

import java.util.List;

public class OrderListAdapter extends BaseQuickAdapter<ShopServiceOrder.DataBean, BaseViewHolder> {
    public OrderListAdapter(@Nullable List<ShopServiceOrder.DataBean> data) {
        super(R.layout.item_order, data);
    }

    private String[] type = {"", "待付款", "进行中", "已完成", "已关闭"};

    //1 平台审批 2 平台同意 3 平台拒绝 4 已退款   afterStatus

    String type2[] = {"", "平台审批", "平台同意", "平台拒绝", "已退款"};

    @Override
    protected void convert(BaseViewHolder helper, ShopServiceOrder.DataBean item) {

        helper.setGone(R.id.tv_tk, item.getAfterStatus() != 0);

        helper.setText(R.id.tv_tk, type2[item.getAfterStatus()]);

        helper.setText(R.id.tv_time, item.getCreateTime());

        helper.setText(R.id.tv_type_name, type[item.getHeadStatusOne()]);

        helper.setText(R.id.tv_name, "联系人：" + item.getUserName());

        helper.setText(R.id.tv_car_name, "到店车辆：" + item.getServiceCar());

        helper.setText(R.id.tv_car_num, "车牌号：" + item.getCarNum());

        helper.setText(R.id.tv_service_time, "服务时间：" + item.getServiceTime());

        helper.setText(R.id.tv_service_num, "共" + item.getShopService().size() + "项服务");

        helper.addOnClickListener(R.id.tv_call_user);

    }
}
